def containsDuplicate(nums):
    table = {}
    for num in nums:
        if num not in table:
            table[num] = 1
        else:
            return True
    return False


nums = [1, 2, 3, 1]
print(containsDuplicate(nums))  # True
